﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
namespace DAL.Dao
{
    public  class DbEntity
    {
        public static ExpressDBEntities expressDBEntities;

        public static void Dispose(){
            if (expressDBEntities!= null)
            {
                expressDBEntities.Dispose();
                expressDBEntities= null;
            }

        }
        public static void CheckConn()
        {
            if (DbEntity.expressDBEntities == null) DbEntity.expressDBEntities = new ExpressDBEntities();
            else if (DbEntity.expressDBEntities.Database.Connection.State == ConnectionState.Closed) DbEntity.expressDBEntities.Database.Connection.Open();
        }
    }
}
